package hupu.hnlp.hot_buffer.distbuffer.configuration.rmi;

import javax.annotation.Resource;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.rmi.RmiServiceExporter;

import hupu.hnlp.hot_buffer.distbuffer.appconfig.AppConfig;
import hupu.hnlp.hot_buffer.share.rmi.distbuffer.DistBuffer;

@Configuration
class MyRmiServiceConfiguration
{
    @Resource
    private DistBuffer dist_buffer;

    @Resource(name = "appconfig")
    private AppConfig appconfig;

    @Bean
    public RmiServiceExporter distBufferService()
    {
        RmiServiceExporter service = new RmiServiceExporter();
        service.setServiceName("distBuffer");
        service.setService(dist_buffer);
        service.setServiceInterface(DistBuffer.class);
        service.setRegistryPort(appconfig.rmi.local);
        return service;
    }
}
